/**
 * 
 * @author  phoenics@126.com
 * @version v.0.1
 * @date  2018年7月29日 下午10:32:21 
 * 
 */
package phoenics.upservice.service;

import java.text.SimpleDateFormat;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import phoenics.upservice.OSSClientConstants;
import phoenics.upservice.dto.ListPage;
import phoenics.upservice.entity.Project;

/**
 *
 */
@Service  
public class UtilSerice {
	 private SimpleDateFormat myFmt=new SimpleDateFormat("yyyy-MM-dd");
	private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(UtilSerice.class);
	public ListPage ListPageMapper(Project project) {
		logger.info(project.getProjectName());
		ListPage lp=new ListPage();
		BeanUtils.copyProperties(project,lp);
		lp.setOpenDate(myFmt.format(project.getOpenDate()));
		lp.getPicUr().clear();
		if(project.getProjectPics().size()>0) {
			//String p=OSSClientConstants.HTTPPATH+project.getProjectPics().get(0).getPicUrl();
			lp.getPicUr().add(OSSClientConstants.HTTPPATH+project.getProjectPics().get(0).getPicUrl());
		}
//		project.getProjectPics().forEach(p->{ 
//			lp.getPicUr().add(OSSClientConstants.HTTPPATH+p.getPicUrl());
//			}
//		);
		return lp;
	}
	
	
	
	
}
